import java.util.*;

//只出现一次的数字(力扣136)
class Solution {
    public int singleNumber(int[] nums) {
        Set<Integer> set=new HashSet<>();
        int res=0;
        for(int i=0;i<nums.length;i++){
            if(set.contains(nums[i])){
                set.remove(nums[i]);
            }else{
                set.add(nums[i]);
            }
        }
        for(int a:set){
            res=a;
        }
        return res;
    }
}


//随机链表的复制(力扣138)
class Node {
    int val;
    Node next;
    Node random;

    public Node(int val) {
        this.val = val;
        this.next = null;
        this.random = null;
    }
}
class Solution1 {
    public Node copyRandomList(Node head) {
        Map<Node,Node> map=new HashMap<>();

        Node cur=head;
        //将新节点和参数的节点存入map中
        while(cur!=null){
            Node newNode = new Node(cur.val);
            map.put(cur,newNode);
            cur=cur.next;
        }

        //这里将新节点的next和random赋值
        cur=head;
        while(cur!=null){
            map.get(cur).next=map.get(cur.next);
            map.get(cur).random=map.get(cur.random);
            cur=cur.next;
        }
        return map.get(head);
    }
}

//宝石与石头(力扣771)
class Solution2 {
    public int numJewelsInStones(String jewels, String stones) {
        int res=0;
        Set<Character> set=new HashSet<>();
        for(int i=0;i<jewels.length();i++){
            set.add(jewels.charAt(i));
        }
        for(int i=0;i<stones.length();i++){
            char ch=stones.charAt(i);
            if(set.contains(ch)){
                res++;
            }
        }
        return res;
    }
}

//旧键盘(牛客网)
 class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String str1 = in.nextLine();
            String str2 = in.nextLine();
            func(str1, str2);
        }
    }
    public static void func(String str1, String str2) {
        StringBuffer s = new StringBuffer();
        //由于键盘的字母都是大写，所以得先给字符串大写
        str1 = str1.toUpperCase();
        str2 = str2.toUpperCase();
        Set<Character> set = new HashSet<>();
        Set<Character> set1=new HashSet<>();
        for (int i = 0; i < str2.length(); i++) {
            set.add(str2.charAt(i));
        }
        for (int i = 0; i < str1.length(); i++) {
            //没有重复过的元素并且没打印过的打印一遍
            if (!set.contains(str1.charAt(i))&&!set1.contains(str1.charAt(i))) {
                set1.add(str1.charAt(i));
                System.out.print(str1.charAt(i));
            }
        }


    }
}